//
// Created by Semir on 2020/4/26.
//

#include <iostream>
#include <algorithm>

using namespace std;

const int MAX_N = 30005;
int w, n;
int arr[MAX_N];

int main() {
    cin >> w >> n;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    sort(arr, arr + n);
    int left = 0;
    int count = 0;
    for (int i = n - 1; i >= left; i--) {
        if (arr[i] + arr[left] <= w) {
            left++;
        }
        count++;
    }
    cout << count << endl;
    return 0;
}